package com.bjc.principle.adaptee;

/**
 * @program: DesignPattern
 * @description: 客户端类：想上网单插不上网线
 * @author: bjc
 * @create: 2020-12-23 21:00
 */
public class Computer {

    //我们的电脑需要连接上转接器才可以上网
    public void net(NetToUsb adapter){
        //上网的具体实现，找一个转接头
        adapter.handleRequest();
    }

    public static void main(String[] args) {
        //电脑  适配器  网线
        Computer computer = new Computer(); //电脑
        Adaptee adaptee = new Adaptee(); //网线
        Adapter adapter = new Adapter(); // 转接器

        computer.net(adapter);

        Adapter2 adapter2 = new Adapter2(adaptee);

        computer.net(adapter2);
    }
}
